***This do file provides commands to generate the tables and figures found
*in the article "Candidate entry in a non-partisan context: Evidence from
*Indonesia

***This is version 2, which includes the expanded models and figures that 
***were added during the publication review process.

*The do file proceeds in the following order:
*Section 1: Appendix: - Socio-demographic Models [Tables A1-A4]
*Section 2: Appendix: - Strategic Context Models [Tables A5-A8]
*Section 3: Fiure 1 [Figures 1a-1d]
*Section 4: Fiure 2 [Figures 2a-2c]
*Section 5: Fiure 3 [Figures 3a-3c]
*Section 6: Fiure 4 [Figures 4a-4c]
*Section 7: Descriptive Statistics [Table 1]




*Run using the file Entry_Replication_Dataset*


**********Section 1: Appendix: - Socio-demographic Models**********

***Table A1: Total candidates, socio-demographic only***

*Table A1: Pooled*
reg totalcandidates ln_pop poverty urbanization largest_rel year_2009 year_2014 year_2019, robust cluster(provid)
*Table A1: 2004*
reg totalcandidates ln_pop poverty urbanization largest_rel if year_2004==1
*Table A1: 2009*
reg totalcandidates ln_pop poverty urbanization largest_rel if year_2009==1
*Table A1: 2014*
reg totalcandidates ln_pop poverty urbanization largest_rel if year_2014==1
*Table A1: 2019*
reg totalcandidates ln_pop poverty urbanization largest_rel if year_2019==1


***Table A2: Total quality challengers, socio-demographic only***

*Table A2: Pooled*
reg total_elected_challenger ln_pop poverty urbanization largest_rel year_2019, robust cluster(provid)
*Table A2: 2014*
reg total_elected_challenger ln_pop poverty urbanization largest_rel if year_2014==1
*Table A2: 2019*
reg total_elected_challenger ln_pop poverty urbanization largest_rel if year_2019==1


***Table A3: Total partisan amateurs, socio-demographic only***

*Table A3: Pooled*
reg total_amateur_partisan ln_pop poverty urbanization largest_rel year_2019, robust cluster(provid)
*Table A3: 2014*
reg total_amateur_partisan ln_pop poverty urbanization largest_rel if year_2014==1
*Table A3: 2019*
reg total_amateur_partisan ln_pop poverty urbanization largest_rel if year_2019==1


***Table A4: Total non-partisan amateurs, socio-demographic only***

*Table A4: Pooled*
reg total_amateur_nonpartisan ln_pop poverty urbanization largest_rel year_2019, robust cluster(provid)
*Table A4: 2014*
reg total_amateur_nonpartisan ln_pop poverty urbanization largest_rel if year_2014==1
*Table A4: 2019*
reg total_amateur_nonpartisan ln_pop poverty urbanization largest_rel if year_2019==1



**********Section 2: Appendix - Strategic Context Models**********




***Table A5: Total candidates***

*Table A5: Pooled*
reg totalcandidates top4 ln_pop poverty urbanization largest_rel year_2014 year_2019, robust cluster(provid)
*Table A5: 2009*
reg totalcandidates top4 ln_pop poverty urbanization largest_rel if year_2009==1
*Table A5: 2014*
reg totalcandidates top4 ln_pop poverty urbanization largest_rel if year_2014==1
*Table A5: 2019*
reg totalcandidates top4 ln_pop poverty urbanization largest_rel if year_2019==1


***Table A6: Total quality challengers***

*Table A6: Pooled*
reg total_elected_challenger top4 ln_pop poverty urbanization largest_rel year_2019, robust cluster(provid)
*Table A6: 2014*
reg total_elected_challenger top4 ln_pop poverty urbanization largest_rel if year_2014==1
*Table A6: 2019*
reg total_elected_challenger top4 ln_pop poverty urbanization largest_rel if year_2019==1


***Table A7: Total partisan amateurs***

*Table A7: Pooled*
reg total_amateur_partisan top4 ln_pop poverty urbanization largest_rel year_2019, robust cluster(provid)
*Table A7: 2014*
reg total_amateur_partisan top4 ln_pop poverty urbanization largest_rel if year_2014==1
*Table A7: 2019*
reg total_amateur_partisan top4 ln_pop poverty urbanization largest_rel if year_2019==1


***Table A8: Total non-partisan amateurs***

*Table A8: Pooled*
reg total_amateur_nonpartisan top4 ln_pop poverty urbanization largest_rel year_2019, robust cluster(provid)
*Table A8: 2014*
reg total_amateur_nonpartisan top4 ln_pop poverty urbanization largest_rel if year_2014==1
*Table A8: 2019*
reg total_amateur_nonpartisan top4 ln_pop poverty urbanization largest_rel if year_2019==1



**********Section 3: Fiure 1 - Total DPD candidates by population**********

*Figure 1a - 2004
twoway (scatter totalcandidates ln_pop if year_2004==1) (lfit totalcandidates ln_pop if year_2004==1), scheme(s1mono) title("Year: 2004") xtitle("Population (logged)") ytitle("# DPD Candidates") ylab(0 "0" 20 "20" 40 "40" 60 "60" 80 "80") xlab(13.12236338 "500K" 13.81551056 "1M" 14.50865774 "2M" 15.20180492 "4M" 15.8949521 "8M" 16.58809928 "16M" 17.28124646 "32M" 17.72753356 "50M") legend(off)
*Figure 1b - 2009
twoway (scatter totalcandidates ln_pop if year_2009==1) (lfit totalcandidates ln_pop if year_2009==1), scheme(s1mono) title("Year: 2009") xtitle("Population (logged)") ytitle("# DPD Candidates") ylab(0 "0" 20 "20" 40 "40" 60 "60" 80 "80") xlab(13.12236338 "500K" 13.81551056 "1M" 14.50865774 "2M" 15.20180492 "4M" 15.8949521 "8M" 16.58809928 "16M" 17.28124646 "32M" 17.72753356 "50M") legend(off)
*Figure 1c - 2014
twoway (scatter totalcandidates ln_pop if year_2014==1) (lfit totalcandidates ln_pop if year_2014==1), scheme(s1mono) title("Year: 2014") xtitle("Population (logged)") ytitle("# DPD Candidates") legend(off) ylab(0 "0" 20 "20" 40 "40" 60 "60" 80 "80") xlab(13.12236338 "500K" 13.81551056 "1M" 14.50865774 "2M" 15.20180492 "4M" 15.8949521 "8M" 16.58809928 "16M" 17.28124646 "32M" 17.72753356 "50M") legend(off)
*Figure 1d - 2019
twoway (scatter totalcandidates ln_pop if year_2019==1) (lfit totalcandidates ln_pop if year_2019==1), scheme(s1mono) title("Year: 2019") xtitle("Population (logged)") ytitle("# DPD Candidates") ylab(0 "0" 20 "20" 40 "40" 60 "60" 80 "80") xlab(13.12236338 "500K" 13.81551056 "1M" 14.50865774 "2M" 15.20180492 "4M" 15.8949521 "8M" 16.58809928 "16M" 17.28124646 "32M" 17.72753356 "50M") legend(off)


**********Section 4: Fiure 2 - Types of DPD candidates by population**********

*Figure 2a - Experienced Challengers
twoway (scatter total_elected_challenger ln_pop) (lfit total_elected_challenger ln_pop), scheme(s1mono) title("Experienced Challengers") xtitle("Population (logged)") ytitle("# DPD Experienced Challengers") xlab(13.12236338 "500K" 13.81551056 "1M" 14.50865774 "2M" 15.20180492 "4M" 15.8949521 "8M" 16.58809928 "16M" 17.28124646 "32M" 17.72753356 "50M") legend(off)
*Figure 2b - Partisan Amateurs
twoway (scatter total_amateur_partisan ln_pop) (lfit total_amateur_partisan ln_pop), scheme(s1mono) title("Partisan Amateurs") xtitle("Population (logged)") ytitle("# DPD Partisan Amateurs") xlab(13.12236338 "500K" 13.81551056 "1M" 14.50865774 "2M" 15.20180492 "4M" 15.8949521 "8M" 16.58809928 "16M" 17.28124646 "32M" 17.72753356 "50M") legend(off)
*Figure 2c - Non-Partisan Amateurs
twoway (scatter total_amateur_nonpartisan ln_pop) (lfit total_amateur_nonpartisan ln_pop), scheme(s1mono) title("Non-Partisan Amateurs") xtitle("Population (logged)") ytitle("# DPD Non-Partisan Amateurs") xlab(13.12236338 "500K" 13.81551056 "1M" 14.50865774 "2M" 15.20180492 "4M" 15.8949521 "8M" 16.58809928 "16M" 17.28124646 "32M" 17.72753356 "50M") legend(off)

**********Section 5: Fiure 3 - Total DPD candidates by top-4 vote share**********

*Figure 3a - 2009
twoway (scatter totalcandidates top4 if year_2009==1) (lfit totalcandidates top4 if year_2009==1), scheme(s1mono) title("Year: 2009") xtitle("Top-4 Vote Share (%)") ytitle("# DPD Candidates") ylab(0 "0" 20 "20" 40 "40" 60 "60" 80 "80") xlab(20 "20" 40 "40" 60 "60" 80 "80") legend(off) 
*Figure 3b - 2014
twoway (scatter totalcandidates top4 if year_2014==1) (lfit totalcandidates top4 if year_2014==1), scheme(s1mono) title("Year: 2014") xtitle("Top-4 Vote Share (%)") ytitle("# DPD Candidates") ylab(0 "0" 20 "20" 40 "40" 60 "60" 80 "80") xlab(20 "20" 40 "40" 60 "60" 80 "80") legend(off) 
*Figure 3c - 2019
twoway (scatter totalcandidates top4 if year_2019==1) (lfit totalcandidates top4 if year_2019==1), scheme(s1mono) title("Year: 2019") xtitle("Top-4 Vote Share (%)") ytitle("# DPD Candidates") ylab(0 "0" 20 "20" 40 "40" 60 "60" 80 "80") xlab(20 "20" 40 "40" 60 "60" 80 "80") legend(off) 



**********Section 6: Fiure 4 - Types of DPD candidates by top-4 vote share**********

*Figure 4a - Experienced Challengers
twoway (scatter total_elected_challenger top4) (lfit total_elected_challenger top4), scheme(s1mono) title("Experienced Challengers") xtitle("Top-4 Vote Share (%)") ytitle("# DPD Experienced Challengers") xlab(20 "20" 40 "40" 60 "60" 80 "80") legend(off)
*Figure 4b - Partisan Amateurs
twoway (scatter total_amateur_partisan top4) (lfit total_amateur_partisan top4), scheme(s1mono) title("Partisan Amateurs") xtitle("Top-4 Vote Share (%)") ytitle("# DPD Partisan Amateurs") xlab(20 "20" 40 "40" 60 "60" 80 "80") legend(off)
*Figure 4c - Non-Partisan Amateur
twoway (scatter total_amateur_nonpartisan top4) (lfit total_amateur_nonpartisan top4), scheme(s1mono) title("Non-Partisan Amateurs") xtitle("Top-4 Vote Share (%)") ytitle("# DPD Non-Partisan Amateurs") xlab(20 "20" 40 "40" 60 "60" 80 "80") legend(off)


**********Section 7: Table 1 - Descriptive Statistics**********
summ totalcandidates total_elected_challenge total_amateur_partisan total_amateur_nonpartisan top4 population poverty urbanization largest_rel

